import Vue from "vue";
import VueRouter from "vue-router";
import MyIndex from "../views/MyIndex.vue";

Vue.use(VueRouter);

const routes = [
    { path: "/", redirect: "/home/commend" },
    {
        path: "/",
        name: "index",
        component: MyIndex,
        children: [
            { path: "/home", redirect: "/home/commend" },
            {
                path: "/home",
                component: () => import("@/views/IndexDetails.vue"),
                children: [
                    { path: "commend", component: () => import("@/views/CommendList/CommendList.vue") },
                    {
                        path: "ranking",
                        component: () => import("@/views/RankingList/RankingList.vue"),
                    },
                    { path: "classify", component: () => import("@/views/ClassList/ClassList.vue") },
                ],
            },
            {
                path: "bookrack",
                component: () => import("@/views/BookRack.vue"),
            },
            {
                path: "mypage",
                component: () => import("@/views/MyPage.vue"),
            },
        ],
    },
    {
        path: "/detailpage/:id",
        name: "detailpage",
        component: () => import("@/views/DetailPage/DetailPage.vue"),
    },
    {
        path: "/cartooncontent/:id",
        name: "cartooncontent",
        component: () => import("@/views/CartoonContent/CartoonContent.vue"),
    },
    {
        path: "/search",
        name: "search",
        component: () => import("@/views/MySearch/MySearch.vue"),
    },
    {
        path: "/login",
        name: "login",
        component: () => import("@/views/Login/MyLogin.vue"),
        children: [
            { path: "/login", redirect: "/login/islogin" },
            { path: "islogin", component: () => import("@/views/Login/IsLogin.vue") },

            { path: "isregister", component: () => import("@/views/Login/IsRegister.vue") },
        ],
    },
];

const router = new VueRouter({
    routes,
});

export default router;
